package com.heima.utils.common;

import com.heima.model.wemedia.entity.WmUser;

/**
 * @author dongcy
 * @date 2024/11/18 16:42
 * @description WmThreadLocalUtil
 */

public class WmThreadLocalUtil {

    private final static ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     * @param wmUser
     */
    public static void setWmUser(WmUser user) {
        WM_USER_THREAD_LOCAL.set(user);
    }

    /**
     * 获取用户
     */
    public static WmUser getWmUser() {
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        WM_USER_THREAD_LOCAL.remove();
    }

}
